const express = require('express');

const query = require('../conn/conn');

const router = express.Router();

router.get('/getItems', async(req, res, next) => {
    let result = await query('select * from product');
    res.send(result);
});


router.get('/getItem', async(req, res, next) => {
    let id = req.query['product_id'];
    let result = await query(`select * from product where id=${id}`);
    res.send(result);
});

router.get('/car', async(req, res, next) => {
    let idList = req.query['idList'];
    let result = await query(`select * from product where id in (${idList})`);
    res.send(result);
});

module.exports = router;